package main;

import java.util.List;
import java.util.Properties;

import dao.FileIO;
import dao.PropertyIO;
import evaluation.EvaluatorFactory;
import evaluation.LayerEvaluator;

public class BatchLayerRecorder {

	public void proceed(Properties properties) {
		String fileListFile = properties.getProperty("file_list_file");
		String modelType = properties.getProperty("modelType");
		String evaluatorType = properties.getProperty("evaluator_type");
		
		LayerEvaluator evaluator = EvaluatorFactory.getEvaluator(evaluatorType);
		evaluator.initialize(properties);

		LayerRecorder lr = new LayerRecorder();
		
		List<String> lines = FileIO.readFile(fileListFile);
		for(String line : lines) {
			String [] tokens = line.split("\\s");
			String filename = tokens[0];
			String labelfile = tokens[1];
			String kListFile = tokens[2];
			lr.proceed(filename, labelfile, modelType, kListFile, evaluatorType, evaluator);
		}
	}
	
	public static void main(String[] args) {
		if(args.length != 1) {
			return;
		}
		
		Properties properties = PropertyIO.load(args[0]);
		BatchLayerRecorder blr = new BatchLayerRecorder();
		blr.proceed(properties);
	}

}
